#ifndef _FACE_RESULT_H_
#define _FACE_RESULT_H_

#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>

#define MATCH_TOP_NUM  1  /*  */



typedef struct tagTsmFaceFeatrue {
    int len; //the length of every face feature vector
    int16_t *vector; //size = nFace * len * sizeof(int16_t)
} TsmFaceFeatrue;

typedef struct tagTsmFaceMatch {
    //length dependent on face_vec_num from user config
    //the feature vector of the face recognized be compared to face_vec_num of feature vector,
    //every result is 1 bit(1: match, 0: not match)
    //the length of every face feature vector match result = (face_vec_num + 31) / 32
    int len;
    uint32_t *bitBool; // size = nFace * len * sizeof(uint32_t)
} TsmFaceMatch;

typedef struct tagTsmFaceBox {
    // the range of x and y is 0.0f~1.0f
    float xmin;
    float ymin;
    float xmax;
    float ymax;
    float score;
} TsmFaceBox;

typedef struct tagTsmPoint {
    float x;
    float y;
} TsmPoint;

typedef struct tagTsmFaceMarker {
    int num; //the marker number of ervery face
    TsmPoint *coor; // size = nFace * num * sizeof(TsmPoint)
} TsmFaceMarker;

typedef struct tagTsmFaceQuality {
    bool fuzzy;
    bool glasses;
    bool cover;
    float pose[3]; //roll pitch yaw
    bool bad_posture;
	bool mask;
} TsmFaceQuality;

typedef struct tsgTsmROI {
    int x;
    int y;
    int w;
    int h;
} TsmROI;

typedef struct tsgTsmFakeResult{
    int     is_fake;
    float   score;
} TsmFakeResult;

typedef struct tagTsmFaceAttrResult
{
    int         is_male;
    float       male_score;
    uint32_t    age;
    float       age_score;
}TsmFaceAttrResult;


typedef struct tagTsmFaceResult {
    int nFace; //detected face number
    int nirFace;        //detect nir face number 
    int frame_count;
    bool visNoCropCheckFailed;
    bool *visCheckFailed; // size = nFace * sizeof(bool)
    bool *nirCheckFailed; // size = nFace * sizeof(bool)
    bool *sl3dCheckFailed; // size = nFace * sizeof(bool)
    float *scoreVis;
    float *socreVisNc;
    float *scoreLive3D;
    float *scoreNir;
    TsmFaceFeatrue feature;
    TsmFaceMatch match;
    TsmFaceBox *box; // size = nFace * sizeof(TsmFaceBox)
    TsmFaceBox *nirBox; // size = nFace * sizeof(TsmFaceBox)
    TsmFaceMarker markers;
    TsmFaceQuality *qa;             //size = nFace * sizeof(TsmFaceQuality)
    int16_t *depthMap;              //640 * 360
    int16_t *dispMap;               //640 * 360
    uint8_t *live3deInput;          //120 * 120
    uint8_t *nirRectify;            //640 * 360
    TsmFaceAttrResult *faceAttr;    //size = nFace * sizeof(TsmFaceAttrResult)        
    TsmROI  roi;
	TsmFaceFeatrue mask_feature;
} TsmFaceResult;


typedef struct
{
	bool		result_valid;
	int			vaild_num;
	int			idx[MATCH_TOP_NUM];
	int16_t		score[MATCH_TOP_NUM];		/*< Q15 */
	uint32_t    match_words;         /* Number of words used for matching*/      
	uint32_t    *bitBool;
	int          error_code;
}TsmMatchResult;

typedef struct tsmPoseResult {
    int nFace;                  //detected face number
    TsmFaceBox *box;                //size = nFace * sizeof(TsmFaceBox)
    float pose[3];              //roll pitch yaw
    int eye2desktop;            //the distance of eye to desktop
    float eye2cam;
    int boundary_status;
} TsmPoseResult;
/**********************************************************
 * TSM STATISTICS ID
 */
typedef enum 
{
    /* hw  */
    STA_ID_3DMAP    =  3001,      /** depthmap    */
    /* net */
    STA_ID_DET      =  1001,      /** det vis     */
    STA_ID_DET_NIR  =  1002,      /** det nir     */
    STA_ID_LM       =  1003,      /** landmark    */
    STA_ID_RECOG    =  1004,      /** recog       */
    STA_ID_VIS      =  1006,      /** fake vis    */
    STA_ID_NIR      =  1008,      /** fake nir    */
    STA_ID_L3D      =  1009,      /** fake sl3d   */
    STA_ID_QA       =  1010,      /** qa          */
    /* other */
    STA_ID_CONVERT  =  2001,
}TsmStaID;



#ifdef __cplusplus
}
#endif

#endif

